\(\int x \cos (2 x) \sec ^3(x) \, dx\) [397]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 67 \[ \int x \cos (2 x) \sec ^3(x) \, dx=-3 i x \arctan \left (e^{i x}\right )+\frac {3}{2} i \operatorname {PolyLog}\left (2,-i e^{i x}\right )-\frac {3}{2} i \operatorname {PolyLog}\left (2,i e^{i x}\right )+\frac {\sec (x)}{2}-\frac {1}{2} x \sec (x) \tan (x) \]

[Out]

-3*I*x*arctan(exp(I*x))+3/2*I*polylog(2,-I*exp(I*x))-3/2*I*polylog(2,I*exp(I*x))+1/2*sec(x)-1/2*x*sec(x)*tan(x
)

Rubi [A] (verified)

Time = 0.16 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.00, number of steps used = 19, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.600, Rules used = {4516, 4266, 2317, 2438, 4498, 4270} \[ \int x \cos (2 x) \sec ^3(x) \, dx=-3 i x \arctan \left (e^{i x}\right )+\frac {3}{2} i \operatorname {PolyLog}\left (2,-i e^{i x}\right )-\frac {3}{2} i \operatorname {PolyLog}\left (2,i e^{i x}\right )+\frac {\sec (x)}{2}-\frac {1}{2} x \tan (x) \sec (x) \]

[In]

Int[x*Cos[2*x]*Sec[x]^3,x]

[Out]

(-3*I)*x*ArcTan[E^(I*x)] + ((3*I)/2)*PolyLog[2, (-I)*E^(I*x)] - ((3*I)/2)*PolyLog[2, I*E^(I*x)] + Sec[x]/2 - (
x*Sec[x]*Tan[x])/2

Rule 2317

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[1/(d*e*n*Log[F]), Subst[Int
[Log[a + b*x]/x, x], x, (F^(e*(c + d*x)))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]

Rule 2438

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2, (-c)*e*x^n]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 4266

Int[csc[(e_.) + Pi*(k_.) + (f_.)*(x_)]*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[-2*(c + d*x)^m*(ArcTanh[E
^(I*k*Pi)*E^(I*(e + f*x))]/f), x] + (-Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Log[1 - E^(I*k*Pi)*E^(I*(e + f*x))],
 x], x] + Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Log[1 + E^(I*k*Pi)*E^(I*(e + f*x))], x], x]) /; FreeQ[{c, d, e,
f}, x] && IntegerQ[2*k] && IGtQ[m, 0]

Rule 4270

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(n_)*((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[(-b^2)*(c + d*x)*Cot[e + f*x]
*((b*Csc[e + f*x])^(n - 2)/(f*(n - 1))), x] + (Dist[b^2*((n - 2)/(n - 1)), Int[(c + d*x)*(b*Csc[e + f*x])^(n -
 2), x], x] - Simp[b^2*d*((b*Csc[e + f*x])^(n - 2)/(f^2*(n - 1)*(n - 2))), x]) /; FreeQ[{b, c, d, e, f}, x] &&
 GtQ[n, 1] && NeQ[n, 2]

Rule 4498

Int[((c_.) + (d_.)*(x_))^(m_.)*Sec[(a_.) + (b_.)*(x_)]*Tan[(a_.) + (b_.)*(x_)]^(p_), x_Symbol] :> -Int[(c + d*
x)^m*Sec[a + b*x]*Tan[a + b*x]^(p - 2), x] + Int[(c + d*x)^m*Sec[a + b*x]^3*Tan[a + b*x]^(p - 2), x] /; FreeQ[
{a, b, c, d, m}, x] && IGtQ[p/2, 0]

Rule 4516

Int[((e_.) + (f_.)*(x_))^(m_.)*(F_)[(a_.) + (b_.)*(x_)]^(p_.)*(G_)[(c_.) + (d_.)*(x_)]^(q_.), x_Symbol] :> Int
[ExpandTrigExpand[(e + f*x)^m*G[c + d*x]^q, F, c + d*x, p, b/d, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && M
emberQ[{Sin, Cos}, F] && MemberQ[{Sec, Csc}, G] && IGtQ[p, 0] && IGtQ[q, 0] && EqQ[b*c - a*d, 0] && IGtQ[b/d,
1]

Rubi steps \begin{align*} \text {integral}& = \int \left (x \sec (x)-x \sec (x) \tan ^2(x)\right ) \, dx \\ & = \int x \sec (x) \, dx-\int x \sec (x) \tan ^2(x) \, dx \\ & = -2 i x \arctan \left (e^{i x}\right )-\int \log \left (1-i e^{i x}\right ) \, dx+\int \log \left (1+i e^{i x}\right ) \, dx+\int x \sec (x) \, dx-\int x \sec ^3(x) \, dx \\ & = -4 i x \arctan \left (e^{i x}\right )+\frac {\sec (x)}{2}-\frac {1}{2} x \sec (x) \tan (x)+i \text {Subst}\left (\int \frac {\log (1-i x)}{x} \, dx,x,e^{i x}\right )-i \text {Subst}\left (\int \frac {\log (1+i x)}{x} \, dx,x,e^{i x}\right )-\frac {1}{2} \int x \sec (x) \, dx-\int \log \left (1-i e^{i x}\right ) \, dx+\int \log \left (1+i e^{i x}\right ) \, dx \\ & = -3 i x \arctan \left (e^{i x}\right )+i \operatorname {PolyLog}\left (2,-i e^{i x}\right )-i \operatorname {PolyLog}\left (2,i e^{i x}\right )+\frac {\sec (x)}{2}-\frac {1}{2} x \sec (x) \tan (x)+i \text {Subst}\left (\int \frac {\log (1-i x)}{x} \, dx,x,e^{i x}\right )-i \text {Subst}\left (\int \frac {\log (1+i x)}{x} \, dx,x,e^{i x}\right )+\frac {1}{2} \int \log \left (1-i e^{i x}\right ) \, dx-\frac {1}{2} \int \log \left (1+i e^{i x}\right ) \, dx \\ & = -3 i x \arctan \left (e^{i x}\right )+2 i \operatorname {PolyLog}\left (2,-i e^{i x}\right )-2 i \operatorname {PolyLog}\left (2,i e^{i x}\right )+\frac {\sec (x)}{2}-\frac {1}{2} x \sec (x) \tan (x)-\frac {1}{2} i \text {Subst}\left (\int \frac {\log (1-i x)}{x} \, dx,x,e^{i x}\right )+\frac {1}{2} i \text {Subst}\left (\int \frac {\log (1+i x)}{x} \, dx,x,e^{i x}\right ) \\ & = -3 i x \arctan \left (e^{i x}\right )+\frac {3}{2} i \operatorname {PolyLog}\left (2,-i e^{i x}\right )-\frac {3}{2} i \operatorname {PolyLog}\left (2,i e^{i x}\right )+\frac {\sec (x)}{2}-\frac {1}{2} x \sec (x) \tan (x) \\ \end{align*}

Mathematica [B] (verified)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(146\) vs. \(2(67)=134\).

Time = 0.23 (sec) , antiderivative size = 146, normalized size of antiderivative = 2.18 \[ \int x \cos (2 x) \sec ^3(x) \, dx=\frac {1}{4} \left (6 x \log \left (1-i e^{i x}\right )-6 x \log \left (1+i e^{i x}\right )+6 i \operatorname {PolyLog}\left (2,-i e^{i x}\right )-6 i \operatorname {PolyLog}\left (2,i e^{i x}\right )+\frac {2 \sin \left (\frac {x}{2}\right )}{\cos \left (\frac {x}{2}\right )-\sin \left (\frac {x}{2}\right )}+\frac {x}{\left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )^2}-\frac {2 \sin \left (\frac {x}{2}\right )}{\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )}+\frac {x}{-1+\sin (x)}\right ) \]

[In]

Integrate[x*Cos[2*x]*Sec[x]^3,x]

[Out]

(6*x*Log[1 - I*E^(I*x)] - 6*x*Log[1 + I*E^(I*x)] + (6*I)*PolyLog[2, (-I)*E^(I*x)] - (6*I)*PolyLog[2, I*E^(I*x)
] + (2*Sin[x/2])/(Cos[x/2] - Sin[x/2]) + x/(Cos[x/2] + Sin[x/2])^2 - (2*Sin[x/2])/(Cos[x/2] + Sin[x/2]) + x/(-
1 + Sin[x]))/4

Maple [B] (verified)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 101 vs. \(2 (48 ) = 96\).

Time = 9.37 (sec) , antiderivative size = 102, normalized size of antiderivative = 1.52

method result size
risch \(\frac {i {\mathrm e}^{i x} \left ({\mathrm e}^{2 i x} x -x -i {\mathrm e}^{2 i x}-i\right )}{\left ({\mathrm e}^{2 i x}+1\right )^{2}}-\frac {3 x \ln \left (1+i {\mathrm e}^{i x}\right )}{2}+\frac {3 x \ln \left (1-i {\mathrm e}^{i x}\right )}{2}+\frac {3 i \operatorname {dilog}\left (1+i {\mathrm e}^{i x}\right )}{2}-\frac {3 i \operatorname {dilog}\left (1-i {\mathrm e}^{i x}\right )}{2}\) \(102\)

[In]

int(x*cos(2*x)*sec(x)^3,x,method=_RETURNVERBOSE)

[Out]

I*exp(I*x)*(exp(I*x)^2*x-x-I*exp(I*x)^2-I)/(exp(I*x)^2+1)^2-3/2*x*ln(1+I*exp(I*x))+3/2*x*ln(1-I*exp(I*x))+3/2*
I*dilog(1+I*exp(I*x))-3/2*I*dilog(1-I*exp(I*x))

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 144 vs. \(2 (38) = 76\).

Time = 0.25 (sec) , antiderivative size = 144, normalized size of antiderivative = 2.15 \[ \int x \cos (2 x) \sec ^3(x) \, dx=\frac {3 \, x \cos \left (x\right )^{2} \log \left (i \, \cos \left (x\right ) + \sin \left (x\right ) + 1\right ) - 3 \, x \cos \left (x\right )^{2} \log \left (i \, \cos \left (x\right ) - \sin \left (x\right ) + 1\right ) + 3 \, x \cos \left (x\right )^{2} \log \left (-i \, \cos \left (x\right ) + \sin \left (x\right ) + 1\right ) - 3 \, x \cos \left (x\right )^{2} \log \left (-i \, \cos \left (x\right ) - \sin \left (x\right ) + 1\right ) - 3 i \, \cos \left (x\right )^{2} {\rm Li}_2\left (i \, \cos \left (x\right ) + \sin \left (x\right )\right ) - 3 i \, \cos \left (x\right )^{2} {\rm Li}_2\left (i \, \cos \left (x\right ) - \sin \left (x\right )\right ) + 3 i \, \cos \left (x\right )^{2} {\rm Li}_2\left (-i \, \cos \left (x\right ) + \sin \left (x\right )\right ) + 3 i \, \cos \left (x\right )^{2} {\rm Li}_2\left (-i \, \cos \left (x\right ) - \sin \left (x\right )\right ) - 2 \, x \sin \left (x\right ) + 2 \, \cos \left (x\right )}{4 \, \cos \left (x\right )^{2}} \]

[In]

integrate(x*cos(2*x)*sec(x)^3,x, algorithm="fricas")

[Out]

1/4*(3*x*cos(x)^2*log(I*cos(x) + sin(x) + 1) - 3*x*cos(x)^2*log(I*cos(x) - sin(x) + 1) + 3*x*cos(x)^2*log(-I*c
os(x) + sin(x) + 1) - 3*x*cos(x)^2*log(-I*cos(x) - sin(x) + 1) - 3*I*cos(x)^2*dilog(I*cos(x) + sin(x)) - 3*I*c
os(x)^2*dilog(I*cos(x) - sin(x)) + 3*I*cos(x)^2*dilog(-I*cos(x) + sin(x)) + 3*I*cos(x)^2*dilog(-I*cos(x) - sin
(x)) - 2*x*sin(x) + 2*cos(x))/cos(x)^2

Sympy [F]

\[ \int x \cos (2 x) \sec ^3(x) \, dx=\int x \cos {\left (2 x \right )} \sec ^{3}{\left (x \right )}\, dx \]

[In]

integrate(x*cos(2*x)*sec(x)**3,x)

[Out]

Integral(x*cos(2*x)*sec(x)**3, x)

Maxima [F]

\[ \int x \cos (2 x) \sec ^3(x) \, dx=\int { x \cos \left (2 \, x\right ) \sec \left (x\right )^{3} \,d x } \]

[In]

integrate(x*cos(2*x)*sec(x)^3,x, algorithm="maxima")

[Out]

-((x*sin(3*x) - x*sin(x) - cos(3*x) - cos(x))*cos(4*x) - (2*x*sin(2*x) + 2*cos(2*x) + 1)*cos(3*x) - 2*(x*sin(x
) + cos(x))*cos(2*x) - 3*(2*(2*cos(2*x) + 1)*cos(4*x) + cos(4*x)^2 + 4*cos(2*x)^2 + sin(4*x)^2 + 4*sin(4*x)*si
n(2*x) + 4*sin(2*x)^2 + 4*cos(2*x) + 1)*integrate((x*cos(2*x)*cos(x) + x*sin(2*x)*sin(x) + x*cos(x))/(cos(2*x)
^2 + sin(2*x)^2 + 2*cos(2*x) + 1), x) - (x*cos(3*x) - x*cos(x) + sin(3*x) + sin(x))*sin(4*x) + (2*x*cos(2*x) +
 x - 2*sin(2*x))*sin(3*x) + 2*(x*cos(x) - sin(x))*sin(2*x) - x*sin(x) - cos(x))/(2*(2*cos(2*x) + 1)*cos(4*x) +
 cos(4*x)^2 + 4*cos(2*x)^2 + sin(4*x)^2 + 4*sin(4*x)*sin(2*x) + 4*sin(2*x)^2 + 4*cos(2*x) + 1)

Giac [F]

\[ \int x \cos (2 x) \sec ^3(x) \, dx=\int { x \cos \left (2 \, x\right ) \sec \left (x\right )^{3} \,d x } \]

[In]

integrate(x*cos(2*x)*sec(x)^3,x, algorithm="giac")

[Out]

integrate(x*cos(2*x)*sec(x)^3, x)

Mupad [B] (verification not implemented)

Time = 27.65 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.94 \[ \int x \cos (2 x) \sec ^3(x) \, dx=\frac {1}{2\,\cos \left (x\right )}+x\,\mathrm {atanh}\left ({\mathrm {e}}^{x\,1{}\mathrm {i}}\,1{}\mathrm {i}\right )-\frac {x\,\sin \left (x\right )}{2\,{\cos \left (x\right )}^2}+\frac {\mathrm {polylog}\left (2,-{\mathrm {e}}^{x\,1{}\mathrm {i}}\,1{}\mathrm {i}\right )\,3{}\mathrm {i}}{2}-\frac {\mathrm {polylog}\left (2,{\mathrm {e}}^{x\,1{}\mathrm {i}}\,1{}\mathrm {i}\right )\,3{}\mathrm {i}}{2}-x\,\mathrm {atan}\left ({\mathrm {e}}^{x\,1{}\mathrm {i}}\right )\,4{}\mathrm {i} \]

[In]

int((x*cos(2*x))/cos(x)^3,x)

[Out]

(polylog(2, -exp(x*1i)*1i)*3i)/2 - (polylog(2, exp(x*1i)*1i)*3i)/2 + 1/(2*cos(x)) - x*atan(exp(x*1i))*4i + x*a
tanh(exp(x*1i)*1i) - (x*sin(x))/(2*cos(x)^2)